$(function () {
    $("#sal_datagrid").datagrid({
        fitColumns: true,
        fit: true,
        toolbar: '#sal_toolbar',
        url: '/chart/sales/list.do',
        pagination: true,
        striped: true,
        rownumbers: true,
        singleSelect: true,
        columns: [[
            {title: '分组类型', field: 'groupby',align:'center', width: '500',formatter: function (value, row, index) {
               return row.groupby;
                }},
            {title: '总金额', field: 'totalamount' ,align:'center', width: '500'}
        ]],
    })

    var methodObj = {
        //刷新按钮
        reload: function () {
            $("#sal_datagrid").datagrid("reload");
        },
        query: function () {
            var qoGroup = $("#qoGroup").textbox("getValue");
            $("#sal_datagrid").datagrid('load', {
                "ordergroupbyint": qoGroup
            });
        }
    }

    $("a[data-cmd]").click(function () {
        var cmd = $(this).data("cmd");
        methodObj[cmd](this);
    })

})

